/*
 * Created: 2020-08-03 15:55:19
 * Author : Mockingbird
 * Email : 1768385508@qq.com
 * -----
 * Description: 
 */

//  const TerserPlugin = require('terser-webpack-plugin')
//  const UptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')

module.exports = {
    flagIncludedChunks: true,
    occurrenceOrder: true,
    usedExports: true,
    sideEffects: true,
    concatenateModules: true,
    // 缓存webpack固定生成的代码块，该代码块通常不i按，用于维系各个模块之间的关系
    // runtimeChunk: {
    //     name: 'mainfest'
    // },
    minimize: true,
    // 指定进行分块的代码和分块后的文件
    splitChunks: {
      chunks: 'all',
      minSize: 30000, // 模块最少大于30KB才拆分
      maxSize: 0,  // 模块大小无上限，只要大于30KB都拆分
      minChunks: 1,
      maxAsyncRequests: 5,
      maxInitialRequests: 5,
        cacheGroups: {
            default: false,
            commons: {
                test: /[\\/]node_modules[\\/]/,
                name: 'vendor',
                chunks: 'all'
            }
        }
    },
}